Subject: Re: Removing Task started with CreateNewProc
From: [email-masked] (Risto Kaivola)
Date: 12 Apr 1994 10:46:39 +0200
Newsgroups: comp.sys.amiga.programmer

[email-masked] (Robert Knop) writes:

>[weird crashes when a parent task is attempting to remove a child
> task in Wait(0L)]

>(1) Is RemTask what you are supposed to use to delete AmiagDOS processes, just
>as you do Exec Tasks?  I couldn't find another function that seemed more
>appropriate for getting rid of the task.  (The entry in the AmigaDOS manual
>about CreateNewProc certainly didn't mention anything, but that entry looks
>like it was written by somebody either in a hurry to get it finished, or who
>didn't like typing a whole lot.)

I'm not sure exactly what is wrong with your code or the operating
system or the documentation, but I think the following is typically
done when a child task wants to remove itself:
     Forbid();
     RemTask(NULL);

The advantage here is that if the child task is executing code
for which the memory was allocated by someone else, this guarantees
that when the allocator of the memory frees the memory, it won't
pull the carpet from under the child.

>(2) Is my code that I discuss here likely OK, meaning that I am getting a
>weird problem with something else that corrupts memory or some such?

This is just a guess, but it may be that the OS does strange things
when a task executing some critical pieces of code is removed. 

>-Rob Knop

-- 
Risto Kaivola
(Internet address:   [email-masked])